package com.gui.menu
{
	import com.greensock.TweenLite;
	import com.utils.ExEvent;
	
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	public class GUIMenu extends Sprite
	{
		public var startBtn:SimpleButton;
		public var tutorialBtn:SimpleButton;
		
		public function GUIMenu()
		{
			super();
			
			trace("GUIMenu");
			startBtn.addEventListener( MouseEvent.CLICK, onStartBtn, false, 0, true);
			tutorialBtn.addEventListener(  MouseEvent.CLICK, onTutorialBtn, false, 0, true);
		}
		
		protected function onTutorialBtn(ev:MouseEvent):void
		{
			trace("onTutorialBtn");
			var tut:GUIMenuTutorial = new GUIMenuTutorial();
			tut.alpha = 0;
			
			addChild(tut);
			TweenLite.to(tut, .3, {alpha:1});
		}
		
		protected function onStartBtn(ev:MouseEvent):void
		{
			startBtn.removeEventListener( MouseEvent.CLICK, onStartBtn);
			tutorialBtn.removeEventListener(  MouseEvent.CLICK, onTutorialBtn);
			
			dispatchEvent( new ExEvent(Event.INIT) );
		}
	}
}